package io.renren.modules.collecting.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.collecting.entity.CollectingSpaceEntity;
import io.renren.modules.collecting.service.CollectingSpaceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 采集空间
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2024-06-27 13:12:13
 */
@RestController
@RequestMapping("space")
public class CollectingSpaceController {
    @Autowired
    private CollectingSpaceService collectingSpaceService;

    /**
     * 空间列表
     */
    @RequestMapping("getList")
    public R getList(@RequestParam Map<String, Object> params){
        PageUtils page = collectingSpaceService.getList(params);
        return R.ok(page);
    }

    /**
     * 空间信息
     */
    @RequestMapping("get")
    public R get(Integer id){
		CollectingSpaceEntity collectingSpace = collectingSpaceService.get(id);
        return R.ok(collectingSpace);
    }

    /**
     * 保存空间
     */
    @RequestMapping("/add")
    public R add(@RequestBody CollectingSpaceEntity collectingSpace){
		collectingSpaceService.add(collectingSpace);
        return R.ok();
    }

    /**
     * 修改空间
     */
    @RequestMapping("/update")
    public R update(@RequestBody CollectingSpaceEntity collectingSpace){
		collectingSpaceService.update(collectingSpace);
        return R.ok();
    }

    /**
     * 删除空间
     */
    @RequestMapping("/delete")
    public R delete(Integer id){
		collectingSpaceService.removeById(id);
        return R.ok();
    }

}
